/**
 * 
 */
package com.jfinal.ext.ret;

import java.io.Serializable;

import net.sf.json.JSONObject;

/**
 * @author YuanZhiHua
 *
 */
public class ReqResult implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2974719921585501934L;

	public static ReqResult POST_PARAM_ERROR = new ReqResult(false, "错误的参数",
			null);

	public static ReqResult SET_DETAIL_FLAG_SUCCESS = new ReqResult(true,
			"更新标志成功", null);

	public static ReqResult BUSNO_NOT_REGISTER_FAILED = new ReqResult(false,
			"商户号未注册", null);

	public static ReqResult SET_DETAIL_FLAG_FAILED = new ReqResult(false,
			"更新标志失败", null);

	public static ReqResult QUERY_DETAIL_FAILED = new ReqResult(false,
			"查询明细为空", null);

	public static ReqResult QUERY_DETAIL_SUCCESS = new ReqResult(true,
			"查询明细成功", null);

	public static ReqResult LOGIN_FAILED = new ReqResult(false, "登录失败", null);

	public static ReqResult LOGIN_SUCCESS = new ReqResult(true, "登录成功", null);

	public static ReqResult QUERY_FAILED = new ReqResult(false, "查询失败", null);

	public static ReqResult QUERY_SUCCESS = new ReqResult(true, "查询成功", null);

	public static ReqResult OPEN_SUCCESS = new ReqResult(true, "开通成功", null);

	public static ReqResult OPEN_ERROR = new ReqResult(false, "开通失败", null);

	public static ReqResult ADD_SUCCESS = new ReqResult(true, "添加成功", null);

	public static ReqResult ADD_ERROR = new ReqResult(false, "添加失败", null);

	public static ReqResult DEL_ERROR = new ReqResult(false, "删除失败", null);

	public static ReqResult DEL_SUCCESS = new ReqResult(true, "删除成功", null);

	public static ReqResult SYSTEM_EXCEPTION = new ReqResult(false, "系统异常",
			null);

	public static ReqResult SQ_FAILED = new ReqResult(false, "申请失败", null);

	public static ReqResult SQ_SUCCESS = new ReqResult(true, "申请成功", null);

	public static ReqResult REG_FAILED = new ReqResult(false, "注册失败", null);

	public static ReqResult REG_SUCCESS = new ReqResult(true, "注册成功", null);

	public static ReqResult RESET_FAILED = new ReqResult(false, "重置失败", null);

	public static ReqResult RESET_SUCCESS = new ReqResult(true, "重置成功", null);

	public static ReqResult SET_SUCCESS = new ReqResult(true, "设置成功", null);

	public static ReqResult SET_FAILED = new ReqResult(false, "设置失败", null);

	public static ReqResult UPDATE_FAILED = new ReqResult(false, "更新失败", null);

	public static ReqResult UPDATE_SUCCESS = new ReqResult(true, "更新成功", null);

	public static ReqResult DOWNLOAD_FAILED = new ReqResult(false, "下载失败", null);

	private String msg;

	private boolean success;

	private Object data;

	private ReqResult(boolean success, String msg, Object data) {
		this.success = success;
		this.msg = msg;
		this.data = data;
	}

	public String getMsg() {
		return msg;
	}

	public ReqResult setMsg(String msg) {
		return new ReqResult(this.success, msg, data);
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public Object getData() {
		return data;
	}

	public ReqResult setData(Object data) {
		return new ReqResult(this.success, this.msg, data);
	}

	@Override
	public String toString() {
		return JSONObject.fromObject(this).toString();
	}
}